﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using InfoJetSoft.Service.Entity;

//CID 0750 //2010.12.30 //Begin
namespace InfoJetSoft.Service.Util
{
    class EXIIds
    {
        public string Id1 { get; set; }
        public string Id2 { get; set; }
        public string Id3 { get; set; }
        public string Id4 { get; set; }
        public string Id5 { get; set; }
        public XmlElement Element { get; set; }

        public EXIIds(Form form, XmlElement element)
        {
            this.Element = element;
            if (this.Element.NamespaceURI != null && this.Element.NamespaceURI.Length > 0)
            {
                XmlElement id1Element = DOMUtil.selectOneNode(this.Element, "pc:EntityId1", form.XmlNsResolver) as XmlElement;
                XmlElement id2Element = DOMUtil.selectOneNode(this.Element, "pc:EntityId2", form.XmlNsResolver) as XmlElement;
                XmlElement id3Element = DOMUtil.selectOneNode(this.Element, "pc:EntityId3", form.XmlNsResolver) as XmlElement;
                XmlElement id4Element = DOMUtil.selectOneNode(this.Element, "pc:EntityId4", form.XmlNsResolver) as XmlElement;
                XmlElement id5Element = DOMUtil.selectOneNode(this.Element, "pc:EntityId5", form.XmlNsResolver) as XmlElement;
                this.Id1 = id1Element.InnerText.Trim();
                this.Id2 = id2Element.InnerText.Trim();
                this.Id3 = id3Element.InnerText.Trim();
                this.Id4 = id4Element.InnerText.Trim();
                this.Id5 = id5Element.InnerText.Trim();
            }
            else
            {
                XmlElement id1Element = DOMUtil.selectOneNode(this.Element, "Id1", form.XmlNsResolver) as XmlElement;
                XmlElement id2Element = DOMUtil.selectOneNode(this.Element, "Id2", form.XmlNsResolver) as XmlElement;
                XmlElement id3Element = DOMUtil.selectOneNode(this.Element, "Id3", form.XmlNsResolver) as XmlElement;
                XmlElement id4Element = DOMUtil.selectOneNode(this.Element, "Id4", form.XmlNsResolver) as XmlElement;
                XmlElement id5Element = DOMUtil.selectOneNode(this.Element, "Id5", form.XmlNsResolver) as XmlElement;
                this.Id1 = id1Element.InnerText.Trim();
                this.Id2 = id2Element.InnerText.Trim();
                this.Id3 = id3Element.InnerText.Trim();
                this.Id4 = id4Element.InnerText.Trim();
                this.Id5 = id5Element.InnerText.Trim();
            }
        }

        public bool IsSame(EXIIds ids)
        {
            if (this.Id1.Equals(ids.Id1) &&
                this.Id2.Equals(ids.Id2) &&
                this.Id3.Equals(ids.Id3) &&
                this.Id4.Equals(ids.Id4) &&
                this.Id5.Equals(ids.Id5))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
    //CID 0750 //2010.12.30 //End
}
//CID 0750 //2010.12.30 //End